package com.xiyu.service.controller.admin.statistics;
import com.xiyu.service.vo.statistics.statisticsCustomer.StatisticsCustomerDealConvertQueryOutput;
import com.xiyu.service.vo.statistics.statisticsCustomer.StatisticsCustomerDealConvertQueryInput;
import com.xiyu.service.vo.statistics.statisticsCustomer.StatisticsCustomerKeyTrendQueryOutput;
import com.xiyu.service.vo.statistics.statisticsCustomer.StatisticsCustomerKeyTrendQueryInput;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import jakarta.validation.*;

import com.xiyu.service.framework.web.web.core.pojo.PageResult;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;
import static com.xiyu.service.framework.web.web.core.pojo.CommonResult.success;

import com.xiyu.service.service.statistics.StatisticsCustomerService;

import java.util.List;

@Tag(name = "客户统计")
@RestController
@RequestMapping("/statistics/statistics-customer")
@Validated
public class StatisticsCustomerController {

    @Resource
    private StatisticsCustomerService statisticsCustomerService;

    @PostMapping("/key-trend-query")
    @Operation(summary = "客户关键行为查询")
    @PreAuthorize("@ss.hasPermission('statistics:customer:keyTrend')")
    public CommonResult<List<StatisticsCustomerKeyTrendQueryOutput>> keyTrendQuery(@Valid @RequestBody StatisticsCustomerKeyTrendQueryInput inputVO) {
        return success(statisticsCustomerService.keyTrendQuery(inputVO));
    }

    @PostMapping("/deal-convert-query")
    @Operation(summary = "客户成交转化率")
    @PreAuthorize("@ss.hasPermission('statistics:customer:dealConvert')")
    public CommonResult<List<StatisticsCustomerDealConvertQueryOutput>> dealConvertQuery(@Valid @RequestBody StatisticsCustomerDealConvertQueryInput inputVO) {
        return success(statisticsCustomerService.dealConvertQuery(inputVO));
    }

}
